package com.sljy.hzk.effect;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

public class EffectManager extends View {

    private final static String TAG = "效果";

    public EffectManager(Context context) {
        super(context);
        init();
    }

    public EffectManager(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public EffectManager(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas){
        super.onDraw(canvas);
        Log.i(TAG,"onDraw");
        DrawCircle(canvas);
    }

    public void DrawCircle(Canvas canvas){
        Paint paint = new Paint();
        paint.setColor(Color.RED);
        paint.setStyle(Paint.Style.FILL);
        paint.setStrokeWidth(50);
        canvas.drawCircle(100, 100, 100, paint);
    }

    private void init(){
        Log.i(TAG,"初始化");
        //invalidate();
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        Log.i(TAG,"onMeasure");
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        Log.i(TAG,"onSizeChanged");
    }

}
